//
//  YURecommendCategoryCell.m
//  百思不得
//
//  Created by 宋禹奇 on 15/9/4.
//  Copyright (c) 2015年 宋禹奇. All rights reserved.
//

#import "YURecommendCategoryCell.h"
#import "YURecommendCategory.h"

@interface YURecommendCategoryCell ()

//选中是显示的指示器控件
@property (weak, nonatomic) IBOutlet UIView *selectedIndicator;

@end

@implementation YURecommendCategoryCell

- (void)awakeFromNib {
    self.backgroundColor = YURGBColor(244, 244, 244);
    self.selectedIndicator.backgroundColor = YURGBColor(219, 21, 26);
    
}

- (void)setCategory:(YURecommendCategory *)category{
    _category = category;
    self.textLabel.text = category.name;
    //YULog(@"%@",category.name);
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    //重新调整内部textlabel的frame
    self.textLabel.y = 2;
    self.textLabel.height = self.contentView.height - 2 * self.textLabel.y;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    self.selectedIndicator.hidden = !selected;
    self.textLabel.textColor = selected ? self.selectedIndicator.backgroundColor : YURGBColor(78, 78, 78);
  
}

@end
